home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group99a.txt / 000084_icon-group-sender _Mon Apr 5 12:24:02 1999.msg < prev    next >
Internet Message Format  |  2000-09-20  |  3KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) id MAA29776
  4.     for icon-group-addresses; Mon, 5 Apr 1999 12:22:27 -0700 (MST)
  5. Message-Id: <199904051922.MAA29776@baskerville.CS.Arizona.EDU>
  6. From: Todd Proebsting <toddpro@microsoft.com>
  7. To: "'Ehud Lamm'" <mslamm@mscc.huji.ac.il>, icon-group@optima.CS.Arizona.EDU
  8. Subject: RE: How programs fail
  9. Date: Mon, 5 Apr 1999 09:42:11 -0700 
  10. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  11. Status: RO
  12.  
  13. I like Icon's model of what is failure and what is an error, although I,
  14. too, have been nailed by a failing expression that in a particular context
  15. is fatal to my application.  To find such, I use the following pattern:
  16.  
  17.     f := open(filename) | runerr(500, filename)
  18.  
  19. runerr(500) is for "Programmer-Specified Errors" and reports "program
  20. malfunction", which is precisely what you want in this circumstance.
  21. Getting the stack trace is useful.
  22.  
  23. Todd
  24.  
  25. -----Original Message-----
  26. From: Ehud Lamm [mailto:mslamm@mscc.huji.ac.il]
  27. Sent: Monday, April 05, 1999 5:13 AM
  28. To: icon-group@optima.CS.Arizona.EDU
  29. Subject: How programs fail
  30.  
  31.  
  32. Had a funny problem today, which may give a lesson to us all.
  33.  
  34. I had some files that needed to be hacked a bit (a chunk was to be removed
  35. from each of them), and I decided to use Icon. 
  36.  
  37. I am using Win95, but my Icon version is quite old - 8.10 I think.
  38.  
  39. It took me a few minutes to find filter.icn in the IPL, change it to my
  40. needs and test to see it works. All was fine.
  41.  
  42. Then I tried to run it on my files, but it didn't work. No error messages,
  43. just that the output files didn't get created, and the input files, which
  44. weren't supposed to change were suddenly empty.
  45.  
  46. It occured to me that Win95 allows long file names, so I changed my
  47. directory names to one word shorter than 8 letters. However things still
  48. didn't work.
  49.  
  50. I tried moving the files arround, to my Icon direcotry, so no path will be
  51. used. No improvement. 
  52.  
  53. It tried &trace - didn't give a clue.
  54.  
  55. Only thing I found out was that the read() from the input file fails.
  56. However, I didn't see any reason for this.
  57.  
  58. I almost decided to think of another solution.
  59.  
  60. And than it hit me...
  61.  
  62. The input files were named *.htm, and I was so happy I found a way to get
  63. meaningful output names with little effort - just call them *.html. This
  64. means my code simply appended an "l".
  65.  
  66. However this made the extension longer than 3 letters... Took me an hour
  67. to notice. A minute to fix. Than it worked.
  68.  
  69. Aside from feeling stupid, I think it would have been nice if Icon would
  70. have yeeld saying that the output file name I gave it was bad. I am not
  71. sure if this can be done in any nice way, but it does show that software
  72. must be maintained, and that the dictum "if it ain't broke don't fix it"
  73. is wrong when applied to software. Other software will be upgraded and
  74. will cause yours to fail.
  75.  
  76. It is also quite sad that instead of producing an error, when the open was
  77. done - the code continued to run and corrupted the input files. Even
  78. sadder is the fact that I had no tools to help analyze the problem. My
  79. Icon version is very lacking in this regard.
  80.  
  81. I seem to recall seeing that Ralph Griswold is teaching Software Eng. Well
  82. I may use this story on my SE students...
  83.  
  84.    
  85.  
  86. Ehud Lamm     mslamm@pluto.mscc.huji.ac.il
  87.  
  88.